package com.huawei.appgallery.forum.comments.ui;

import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.huawei.appgallery.forum.base.ui.JGWTabFragment;
import com.huawei.appgallery.forum.comments.api.ICommentDetailProtocol;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment;
import com.huawei.appgallery.foundation.ui.framework.cardframe.fragment.TaskFragment.b;
import com.huawei.hmf.annotation.FragmentDefine;
import o.bqz.c;
import o.brz;
import o.bse;
import o.bsl;
import o.bul;
import o.cia;

@FragmentDefine(alias = "comment.detail.inner.fragment", protocol = ICommentDetailProtocol.class)
public class CommentDetailFragment extends JGWTabFragment {
    private int ʻˋ;
    private int ʼˋ = -1;
    private bul ﾞ;

    public void ˏ(Bundle bundle) {
        ॱˑ();
        ॱˉ();
        this.ʼ = new bsl(this, null, this.ʼˊ);
        super.ˏ(bundle);
    }

    private void ॱˑ() {
        ICommentDetailProtocol iCommentDetailProtocol = (ICommentDetailProtocol) this.ﹳ.ॱ();
        this.ʻˋ = iCommentDetailProtocol.getErrorCode();
        this.ʼˊ = iCommentDetailProtocol.getUri();
    }

    public void ʽ(String str) {
        this.ʼˊ = str;
        ॱॱ(str);
    }

    public boolean ˊ(TaskFragment taskFragment, b bVar) {
        boolean ˊ = super.ˊ(taskFragment, bVar);
        if (ʼʼ() != null) {
            ʼʼ().ˋ(taskFragment, bVar);
        }
        if (!(this.ʼˋ == -1 || this.ͺˎ == null)) {
            W_();
        }
        return ˊ;
    }

    public void ˎͺ() {
        super.ˎͺ();
    }

    public cia ˊ(Context context) {
        this.ﾞ = new bul(context);
        return this.ﾞ;
    }

    public bul ॱʾ() {
        return this.ﾞ;
    }

    public void ˊॱ(int i) {
        this.ʼˋ = i;
    }

    public void W_() {
        this.ͺˎ.smoothScrollToPosition(this.ʼˋ);
        new Handler().postDelayed(new Runnable(this) {
            final /* synthetic */ CommentDetailFragment ˎ;

            {
                this.ˎ = r1;
            }

            public void run() {
                if (this.ˎ.ͺˎ != null) {
                    this.ˎ.ͺˎ.setSelection(this.ˎ.ʼˋ);
                }
                this.ˎ.ˊॱ(-1);
            }
        }, 200);
    }

    public View ˋ(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
        super.ˋ(layoutInflater, viewGroup, bundle);
        if (this.ʻˋ > 0) {
            ˋॱ(false);
        }
        return this.ॱˍ;
    }

    private void ॱˉ() {
        if (this.ʻˋ > 0) {
            brz ॱ = bse.ˏ.ॱ(this.ʻˋ);
            ʻ(ॱ.ˋ());
            ʼ(ॱ.ˎ());
            ˏॱ(false);
            return;
        }
        ʻ(c.ॱ);
        ʼ(bse.ˏ.ॱ(400001).ˎ());
    }
}
